﻿@{
  
    Layout = "~/Areas/Shared/_spEdit.cshtml";
}
@using Kaiser.Extensions
@model Kaiser.Modules.CMS.Models.ContentInput
<script type="text/javascript"   src="@Url.Content("~/Scripts/ueditor/editor_config.js")"></script>
<script type="text/javascript"  src="@Url.Content("~/Scripts/ueditor/editor_all_min.js")"></script>

<link href="@Url.Content("~/Scripts/Uploadify/3.1/uploadify.css")" rel="stylesheet"  type="text/css" />
<script src="@Url.Content("~/Scripts/Uploadify/3.1/swfobject.js")"   type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Uploadify/3.1/jquery.uploadify-3.1.min.js")"   type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Plugins/jquery-jtemplates.js")"   type="text/javascript"></script>

<form method="post">
    <div class="ftitle">基本信息</div>
    <table width="100%">
        <tr>
            <td style="width: 10%;">栏目：
            </td>
            <td>
              
                @if (!string.IsNullOrWhiteSpace(Request["categoryId"]))
                {
                      @Html.TextBoxFor(m => Model.listCategoryContentInput, new { @Class = "easyui-combotree", @Style = "width:450px" ,@Value=Request["categoryId"]})
                
                }
                else
                {
                     @Html.TextBoxFor(m => Model.listCategoryContentInput, new { @Class = "easyui-combotree", @Style = "width:450px" })
                }
                    
            </td>
        </tr>
        <tr>
            <td>新闻编号：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.Code, new { @maxlength = "50", @Style = "width:450px" })
            </td>
        </tr>
        <tr>
            <td>标题：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.ContentTitle, new { @Class = "easyui-validatebox", @required = "true", @Style = "width:450px" })
            </td>
        </tr>
        <tr>
            <td>副标题：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.SecondTitle, new { @maxlength = "50", @Style = "width:450px" })
            </td>
        </tr>
        <tr>
            <td>关键字：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.ContentKeywords, new { @maxlength = "50", @Style = "width:450px" })
            </td>
        </tr>
        <tr>
            <td>来源：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.SourceDerivation, new { @Style = "width:450px" })
            </td>
        </tr>
        <tr>
            <td>作者：
            </td>
            <td>
                @Html.TextBoxFor(m => Model.SourceAuthor, new { @Style = "width:450px" })
            </td>
        </tr>


        <tr>
            <td>文章属性：
            </td>
            <td>
                @Html.CheckBoxFor(m => Model.groom)推荐
                @Html.CheckBoxFor(m => Model.topLine)头条
                @Html.CheckBoxFor(m => Model.hot)热门
                @Html.CheckBoxFor(m => Model.stick)置顶
                @Html.CheckBoxFor(m => Model.cream)精华
                @Html.CheckBoxFor(m => Model.roll)滚动
            </td>
        </tr>
        <tr>
            <td>发布时间：
            </td>
            <td>
                @{
                    if (!Model.PublishDateTime.HasValue)
                    {
                        Model.PublishDateTime = DateTime.Now;
                    }
                }

                @Html.TextBox(Html.PropertyNameFor(x => Model.PublishDateTime), Model.PublishDateTime.Value.ToString("yyyy-MM-dd"), new { @class = "easyui-datebox" })




            </td>
        </tr>
    </table>
    <div class="ftitle">简介</div>

    @Html.TextAreaFor(m => Model.ContentSummary, new { @style = "width:100%;height:120px;", @cols = 27, @rows = 1 })



    <div class="ftitle">内容</div>

    @Html.TextAreaFor(m => m.ContentDetail, new { @Class = "editor" })



    <div class="ftitle">附件</div>
    <div id="addPic" class="attachList">
    </div>
    <div id="some_file_queue2" class="some_file_queue">
    </div>
   
</form>
<script type="text/javascript">

    dlg_Edit_form_submitEvent = function () {
        var content = UE.getEditor('editor').getContent();
        $("#editor").val(encodeURIComponent(content));
        //  $("#ContentSummary").val(encodeURIComponent(UE.getEditor('ContentSummary').getContent()));
        return true;
    };
    $(document).ready(function () {
        $('#listCategoryContentInput').combotree({
            url: '@Url.Action("GetCategoryTree", "Category", new { area = "CMS" })',
            required: true,
            multiple: false
        });


 
        //var editor2 = new UE.ui.Editor();
        //editor2.render("ContentSummary");

        $(".attachList").each(function () {

            var o = $(this);
            var oid = o.attr("id");
            var oVal = o.text();

            //   var arr = $.parseJSON(oVal);
            var photoContern = $("<div id='" + oid + "_photoContern'></div>");
            o.after(photoContern);
            o.uploadify({
                //'formData': { "ObjectID": $("#ProductId").val(), "ObjectModule": "Content_PhotoList" },
                'swf': '@Url.Content("~/Scripts/Uploadify/3.1/uploadify.swf")',
                'uploader': '@Url.Action("UploadFiles", "AttachManage", new { area = "Admin" })',
                'queueID': 'some_file_queue2',
                "buttonText": "点击添加",
                'buttonCursor': 'arrow',
                onInit: function (instance) {
                    var obj = $("#" + instance.settings.id);

                    //if (arr && arr.length > 0) {
                    //    for (var i = 0; i < arr.length; i++) {
                    //        var photo = arr[i];

                    //        photoContern.append('<img width=120 height=88   style="border: 1px solid #95b8e7; margin-right: 8px" src="' + photo.SourceUrl + '" />');


                    //    }
                    //}

                },
                onUploadSuccess: function (a, b) {
                    //var result = $.parseJSON(b);
                    //if (result.msg != "" && result.msg != undefined) {
                    //    alert(result.msg);
                    //} else {

                    //    photoContern.append('<img width=120 height=88   style="border: 1px solid #95b8e7; margin-right: 8px" src="' + result.Data.FilePath + '" />');

                    //}
                    ////photoContern.find("")
                }
            });

        });


    });
</script>
